﻿using System.Data.Entity.ModelConfiguration;

namespace wh40klbModel.ModelConfiguration
{
    class SquadConfiguration : EntityTypeConfiguration<Squad>
    {
        public SquadConfiguration()
        {
            //Cle Primaire et table
            HasKey(s => s.Id);
            //Propriete
            Property(s => s.Name).IsRequired();
            //cle etrangere
            HasRequired(s => s.SquadType).WithMany(st => st.Squads);
            HasMany(s => s.Vehicules).WithRequired(sti => sti.Squad);
        }
    }
}
